package com.lgd.factoryattendance.Utils;

import android.annotation.SuppressLint;
import android.app.Application;
import android.util.Log;


import com.github.anrwatchdog.ANRError;
import com.github.anrwatchdog.ANRWatchDog;
import com.lgd.factoryattendance.httpService.API;

/**
 * @Author lgd
 * @Date 2024/4/18 10:14
 *   全局  Application类  初始化一些全局的东西
 */
public class MyApplication extends Application {
    private static final String TAG = "-------MyApplication:------";
    @Override
    public void onCreate() {
        super.onCreate();
        API.init();
        MyUncaughtExceptionHandler.getInstance(MyApplication.this).init();

        new ANRWatchDog().setANRListener(new ANRWatchDog.ANRListener() {
            @SuppressLint("LongLogTag")
            @Override
            public void onAppNotResponding(ANRError error) {
                // 处理错误。例如，将其记录到HockeyApp：
                Log.d(TAG, "onAppNotResponding: ANR发生"+ error.toString());
            }
        }).start();
    }

}
